package com.kangyi.user.service.Impl;

import cn.hutool.core.collection.CollUtil;
import com.kangyi.constant.MessageConstant;
import com.kangyi.exception.DataNotExistException;
import com.kangyi.user.mapper.BannerMapper;
import com.kangyi.user.service.BannerService;
import com.kangyi.vo.BannerVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Blank
 * @version 1.0
 */
@Service
public class BannerServiceImpl implements BannerService {

    @Autowired
    private BannerMapper bannerMapper;

    @Override
    public List<BannerVO> inquiryBanner(Integer number) {
        List<BannerVO> bannerVOList = bannerMapper.inquiryBanner(number);

        if (CollUtil.isEmpty(bannerVOList)) {
            throw new DataNotExistException(MessageConstant.DATA_NOT_EXIST);
        }

        return bannerVOList;
    }

}
